home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 2: CDPD 1 / Almathera Ten on Ten - Disc 2: CDPD 1.iso / pd / 076-100 / 079 / scnsizer / scnsizer.c < prev    next >
C/C++ Source or Header  |  1995-03-13  |  3KB  |  102 lines

  1. /* ScnSizer.c
  2.  *
  3.  * Thad Floryan, 7 March 1987
  4.  *
  5.  * Sets the Preferences data for increasing the window bounds.  From the
  6.  * default parameters, RowSizeChange and ColumnSizeChange are the values
  7.  * added to the window size.  ViewXOffset and ViewYOffset are the delta
  8.  * from the default upper left corner.
  9.  *
  10.  * Usage:
  11.  *
  12.  *    CLI> ScnSizer [ row.delta  col.delta  [ -xoffset  -yoffset ] ]
  13.  *
  14.  * argv:     [0]      [1]          [2]      [3]         [4]
  15.  * argc:      1        2           3       4          5
  16.  *
  17.  *        no args causes the present values to be displayed, else
  18.  *        row.delta is the number of rows (V) to be added
  19.  *        col.delta is the number of columns (H) to be added
  20.  *        xoffset is the upper left corner x delta, usually negative
  21.  *        yoffset is the upper left corner y delta, usually negative
  22.  *
  23.  * Note: the Preferences structure is exactly the size of and is stored in
  24.  *     SYS:DEVS/system-configuration.  This program calls RethinkDisplay()
  25.  *     for an immediate screen update if parameters are changed; to save
  26.  *     the parameters permanently, use the Preferences program.
  27.  *
  28.  * This program inspired by Neil Katin's "MoreRows" and enhanced/fixed from
  29.  * Marco Papa's "MyMoreRows".  Compiled and linking using the Manx Axtec C
  30.  * version 3.4a package per:
  31.  *
  32.  *    CLI> cc ScnSizer.c
  33.  *    CLI> ln ScnSizer.o -lc
  34.  *
  35.  * Note also that the AmigaDOS version 1.2 "final" includes must be used
  36.  * else certain definitions (esp. in intuition.h) won't be available.
  37.  */
  38.  
  39. #include <functions.h>
  40. #include <exec/types.h>
  41. #include <intuition/intuition.h>
  42.  
  43. #define INTUITION_REV 33L  /* Must be Kick & Work 33.180 & 33.46|33.47 */
  44.  
  45. struct IntuitionBase *IntuitionBase;
  46.  
  47. main(argc, argv)
  48. int argc;
  49. char *argv[];
  50. {
  51.    struct Preferences *PrefBuffer;
  52.    char *malloc();
  53.    BYTE  rowsizechange, columnsizechange;
  54.    BYTE  viewxoffset, viewyoffset;
  55.  
  56.    IntuitionBase = (struct IntuitionBase *)
  57.             OpenLibrary("intuition.library", INTUITION_REV);
  58.    if( IntuitionBase == NULL ) {
  59.     puts("Can't open intuition library");
  60.     exit(TRUE);
  61.    }
  62.  
  63.    PrefBuffer = (struct Preferences *)
  64.              malloc((unsigned) sizeof(struct Preferences));
  65.  
  66.    GetPrefs(PrefBuffer, (long) sizeof(struct Preferences));
  67.  
  68.    if (argc>2) {
  69.       if (argc>4) {
  70.      viewxoffset = atoi(argv[3]);
  71.      viewyoffset = atoi(argv[4]);
  72.       }
  73.       else {
  74.      viewxoffset = PrefBuffer->ViewXOffset;
  75.      viewyoffset = PrefBuffer->ViewYOffset;
  76.       }
  77.       rowsizechange    = atoi(argv[1]);
  78.       columnsizechange = atoi(argv[2]);
  79.  
  80.       PrefBuffer->RowSizeChange    = rowsizechange;
  81.       PrefBuffer->ColumnSizeChange = columnsizechange;
  82.       PrefBuffer->ViewXOffset      = viewxoffset;
  83.       PrefBuffer->ViewYOffset      = viewyoffset;
  84.       SetPrefs(PrefBuffer, (long) sizeof(struct Preferences), TRUE);
  85.       RethinkDisplay();
  86.    }
  87.    else {
  88.       printf("\tAlters the present default Workbench screen parameters by\n");
  89.       printf("\tincreasing the rows & columns and offsetting the base.\n");
  90.       printf("Usage:\n");
  91.       printf("\t%s [row.delta col.delta [x.offset y.offset]]\n", argv[0]);
  92.       printf("Present values:\n");
  93.       printf("\trow.delta = %d\n", (int) PrefBuffer->RowSizeChange);
  94.       printf("\tcol.delta = %d\n", (int) PrefBuffer->ColumnSizeChange);
  95.       printf("\tx.offset  = %d\n", (int) PrefBuffer->ViewXOffset);
  96.       printf("\ty.offset  = %d\n", (int) PrefBuffer->ViewYOffset);
  97.    }
  98.  
  99.    free(PrefBuffer);
  100.    CloseLibrary(IntuitionBase);
  101. }
  102.